
package com.joysuch.wwyt.core.support;

import java.util.Optional;

import org.springframework.data.domain.AuditorAware;

public class EntityAuditorAware implements AuditorAware<Long> {

    @Override
    public Optional<Long> getCurrentAuditor() {
        Long userId = Context.getCurrentUserId();
        return Optional.of(userId == null ? -1L : userId);
    }

}
